﻿<%@ Page Language="C#" validaterequest="false" AutoEventWireup="true" CodeBehind="SectionInformationEdit.aspx.cs" Inherits="ExaminationSys.View.Section.SectionInformationEdit" %>
 
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>栏目详细</title>
    <script src="../../UEditor/editor_config.js" type="text/javascript"></script>
<script src="../../UEditor/editor_all_min.js" type="text/javascript"></script>
<link href="../../UEditor/themes/default/ueditor.css" rel="stylesheet" type="text/css" />
<style type="text/css">

        #btnBar
        {
            top:460px; 
            position:absolute;
            left:358px;
        }
        #btnBar div
        {
           float:left;
           padding-left:15px;
        }
</style> 
<script type="text/javascript">
    var CloseWin = function () {
        parent.win.hide();
    }

    var urlStr = "ashx/Section.ashx";
    var SaveInfo = function () {

        var sectionId = document.getElementById("hidSectionID").value;
        var id = document.getElementById("HidId").value;
        var content = escape(getEditText());  //特殊编码转换
        Ext.Ajax.request({
            url: urlStr,
            params: {
                action: "addSectionInformation",
                ID: id,   //参数
                SectionID: sectionId,
                Title: '',
                OrderIndex: 0,
                Content: content
            },
            method: 'POST',
            success: function (response) {
                if (response) {
                    if (response.responseText.indexOf("true") >= 0) {
                        Ext.Msg.alert("提示", "保存成功");
                        setTimeout(function () { parent.win.hide(); }, 2000);
                       
                    }

                }
            },
            failure: function () {
                Ext.Msg.alert("提示", "方法调用失败");
            }
        });

    }



</script>

</head>
<body>
    <form id="form1" runat="server">
    
   <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <div>
    <div id="tbEditor" style="height:480px; width:760px;"  >
       
    </div>
    <asp:HiddenField ID="hidSectionID" runat="server" />
    <asp:HiddenField ID="HidId" runat="server" />
    <asp:HiddenField ID="hidSubitem" runat="server" />
    <asp:HiddenField ID="hidContent" runat="server" /> 
    <div id="btnBar">
    
       <Buttons>
        <ext:Button ID="SaveButton" runat="server" Text="保存" Icon="BulletGo">
              <Listeners>
                <Click Fn="SaveInfo" />
            </Listeners> 
        </ext:Button>
        <ext:Button ID="CancelButton" runat="server" Text="取消" Icon="Cancel">
            <Listeners>
                <Click Fn="CloseWin" />
            </Listeners>
        </ext:Button>
  
    </div>
        
     <script type="text/javascript">
         var editor;

         Ext.onReady(function () {
             editor = new baidu.editor.ui.Editor({
                 iframeCssUrl: '../../UEditor/themes/default/iframe.css',
                 textarea: 'myEditor',
                 initialContent: unescape(document.getElementById("hidContent").value)
             });
             editor.render("tbEditor");

             //获取SectionID 对应 SectionInfomation 表的数据
            
         })
         var getEditText = function () {
             return editor.getContent();

         }

         var setEditText = function (content) {
             return editor.setContent(content);
         }


        

    </script>

    
    
    </div>
    </form>
</body>
</html>
